Capella provides the capacity to launch actions from command line. Potential actions are Model Validation, Model Migration, HTML Production, Refresh Representations, Remove Hidden Elements from Representations and Export Representations as Images.
The core mechanism provides the following parameters:
| Name | Category | Description |
|---|---|---|
| appid | mandatory | defines the id of the command line application to launch. Command line applications are plugins that extend the core mechanism (e.g. model validation) |
| data | optional | defines the path to the workspace |
| input | mandatory | defines a list of the relative paths (to the workspace) of the Eclipse projects or aird files to use as input of the command line. The list have to be placed into quotes "" and separated by a | character. Use /all to specify that all projects in the workspace are used as input. |
| import | optional | defines a list of the path of the Eclipse projects to import into the workspace before doing the actual job. The list have to be placed into quotes "" and separated by a | character |
| forceimport | optional | unreference/delete exiting project from the workspace while importing projects using command line. Without this option, an error is logged if a project with the same name than the imported project exists already in the workspace |
| outputfolder | optional | defines the relative path (to the workspace) of the output folder |
| exportZip | optional | defines a list of the relative paths of the Eclipse projects to export as zip. The list have to be placed into quotes "" and separated by a | character. Use /all to specify that all projects in the workspace are exported. This parameter must be used with -outputfolder to specify the folder that contains the zips. |
| nosplash | optional | launch Capella without the initial splash screen |
| consolelog | optional | allows to send additional log messages (e.g. exceptions) into the console output |
| logfile | optional | defines the path to the log file (if not specified, log file is created in the workspace directory with the name MDEReport.html) |
| help | optional | prints the help message |
|
|
|
The model validation command line provides the following additional parameters:
| Name | Category | Description |
|---|---|---|
| outputfolder | mandatory | defines the path to the output folder to generate the validation report. |
| validationruleset | optional | defines path to the epf file of the disalbed rule IDs |
| validationcontext | optional | defines the list of path to objects to validate |
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.core.validation.commandline -data <workspacePath> -input "/EOLE_AF/EOLE_AF.aird" -outputfolder /DocProject/validation -logfile D:/CommandLineLog/log.html
This command validates the model corresponding to the <workspacePath>/EOLE_AF/EOLE_AF.aird file and generates a report to the output folder <workspacePath>/DocProject/validation.
DocProject must be a general Eclipse project (not a directory) initially created into the specified workspace, with inside a folder named validation . As well, EOLE_AF must exist as Capella project inside the same workspace. A log file can be also specified with the parameter -logfile
Complex use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.core.validation.commandline -input /EOLE_AF/EOLE_AF.aird -outputfolder /DocProject/validation -validationruleset D:/EPF/exportall.epf -validationcontext "EOLE_AF/EOLE_AF.capella#971d9934-9780-4e41-b02e-312d0eac3223 | EOLE_AF EOLE_AF/fragments/OA-Operational%20Context-Operational%20Entity.capellafragment#c6aebe52-c8a4-4d35-8105-177c87470bef" -data <workspacePath> -logfile D:/CommandLineLog/log.html
This new command uses a -validationruleset parameter to specify the path to an Eclipse Property File (epf file) and a -validationcontext parameter to specify the set of URIs of model elements to validate. The set of rule to validate against are stored into the exported epf file.
The parameter -forceoutputfoldercreation becomes necessary for the following cases :
A log file is also specified.
This command will export selected project to the given zip filename
Mandatory parameters:
(usage of “qualifier” in the output file name will be replaced by current date/time)
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.core.commandline.core.exportZip -data <workspacePath> -export "EOLE_AF" -exportZipName "/EOLE_AF/EOLE_qualifier.zip" -filepath "/EOLE_AF/EOLE_AF.aird" -outputfolder "/EOLE_AF/output" -forceoutputfoldercreation -logfile D:/CommandLineLog/log.html
| Name | Category | Description |
|---|---|---|
| backup | optional | whether the model is backed up during the migration. |
This command will migrate the project(s) given as input. A workspace folder is created and located where the command is triggered or in a specified path given by the -data parameter. It creates a log file located in the .metadata folder of the workspace. If the input project is a folder, it will be backed up and migrated inside this folder, otherwise if the input is a zip file it will be unzipped and project(s) inside it will be migrated into the workspace folder.
For a migration and post-migration script example, please check: Migration and Post-Migration script example
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.migration -data <workspacePath> -import D:/Projects/EOLE_AF.zip -input /all -exportZip EOLE_AF -outputfolder /MigratedProject/output -backup
This command imports a .zip into the specified workspace, migrate all projects inside and exported the migrated project as zip to the output folder.
If you migrate a project using libraries, all dependent projects/libraries must be included and the sequence order matters.
Consider the example below:
The migration process must be done according to the following sequence:
In such a case, the migration sequence can be done either by launching several unary migration commands on each project/library or by giving the whole sequence through the -import parameter (using | separator).
Complex use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.migration -import "D:/Projects/Library3 | D:/Projects/Library1 | D:/Projects/Library2 | D:/Projects/Project1" -input /all -data <workspacePath> -logfile D:/CommandLineLog/log.html
This command migrates the given project/libraries and creates a log.html at the specified location.
This command will refresh all representations. More information here: Diagram Refreshing Strategies
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.refreshRepresentations -data <workspacePath> -input "/EOLE_AF/EOLE_AF.aird" -outputfolder "/EOLE_AF/output"
| Name | Category | Description |
|---|---|---|
| unsyncDiags | optional | all the elements with Unsynchronizable and Not synchronized mappings will be removed from diagrams. if not, only elements with Not synchronized mappings will be removed from diagrams. |
This command will remove all hidden elements of all representations. More information here: Removing Hidden Elements from Diagrams
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.removeHiddenElements -data <workspacePath> -input "/EOLE_AF/EOLE_AF.aird" -outputfolder "/EOLE_AF/output"
| Name | Category | Description |
|---|---|---|
| outputfolder | mandatory | defines the path to the output folder to export images. |
| imageFormat | optional | allows to choose the images format: JPG (by default), PNG, SVG, BMP, GIF |
| exportToHtml | optional | an html page for each images |
| exportDecorations | optional | for exporting decorations |
This command will export images of all representations to the given outputfolder. More information here: Export_As_Image
Simple use case:
<CapellaInstallationPath>/capellac.exe -nosplash -application org.polarsys.capella.core.commandline.core -appid org.polarsys.capella.exportRepresentations -data <workspacePath> -input "/EOLE_AF/EOLE_AF.aird" -outputfolder "/EOLE_AF/output"